{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">优惠码段：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text start_num" placeholder="起始号码" name="start_num" value="{$start_num ?? '123456'}" readonly/> --
                <input type="number" class="input-text end_num" placeholder="结束号码" name="end_num" value="{$end_num ?? '123456'}" readonly/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">批次号：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <input type="text" class="input-text batch" placeholder="批次号" name="batch" value="{$batch}" readonly/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>有效期：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text" placeholder="有效期" name="expiry" value="{$expiry ?? '3'}"  datatype="*" nullmsg="请填写有效期" readonly/> 个月
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>客户优惠类型：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal" >
                <div class="radio-box" nullmsg="请选择客户优惠类型">
                    <input type="radio" name="company_type" id="company_type-0" value="1" datatype="*" nullmsg="请选择客户优惠类型">折扣优惠
                    <label for="company_type-0"></label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="company_type" id="company_type-1" value="2" datatype="*" nullmsg="请选择客户优惠类型">固定金额
                    <label for="company_type-1"></label>
                </div>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>客户优惠值：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text" placeholder="优惠值" name="company_value" value="{$vo.company_value ?? ''}"  datatype="*" nullmsg="请填写客户优惠值" readonly/>
                <span class="company_value"></span>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>快递员收益类型：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">
                <div class="radio-box">
                    <input type="radio" name="offline_type" id="offline_type-0" value="1" datatype="*" nullmsg="请选择快递优惠类型">折扣收益
                    <label for="offline_type-0"></label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="offline_type" id="offline_type-1" value="2" datatype="*" nullmsg="请选择快递优惠类型">固定金额收益
                    <label for="offline_type-1"></label>
                </div>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>快递收益值：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text offline_value" placeholder="快递收益" name="offline_value" value="{$vo.offline_value ?? ''}"  datatype="*" nullmsg="请填写快递员收益值" readonly/>
                <span class="offline_value"></span>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea class="textarea" placeholder="" name="remark" onKeyUp="textarealength(this,100)">{$vo.remark ?? ''}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <!--<div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>-->
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script>
    $(function () {
        $("[name='company_type'][value='{$vo.company_type ?? ''}']").prop("checked", true);
        $("[name='offline_type'][value='{$vo.offline_type ?? ''}']").prop("checked", true);

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });

        //取卡数失焦时  计算号码段
        $('.num').blur(function(){
            var num = $('.num').val();
            var start_num = $('.start_num').val();
            var new_num = Number(num) + Number(start_num) - 1;
            var end_num = $('.end_num').val(new_num);
        });


        //选择客户优惠类型时  显示对应优惠值
        $('#company_type-0').click(function(){
            $('.company_value').empty().append('折');
        });
        $('#company_type-1').click(function(){
            $('.company_value').empty().append('元');
        });

        //选择快递收益类型时  显示对应收益值
        $('#offline_type-0').click(function(){
            $('.offline_value').empty().append('折');
        });
        $('#offline_type-1').click(function(){
            $('.offline_value').empty().append('元');
        });

    })
</script>
{/block}
